package samples.d3.color 
{
	import color.HSL;
	import color.RGB;
	import flash.geom.Rectangle;
	import flash.utils.setInterval;
	import samples.BaseSample;
	import shapes.shapes2D.Quad;
	
	/**
	 * @author Nicolas Barradeau
	 * http://en.nicoptere.net
	 */
	public class Color2 extends BaseSample 
	{
		
		private var hsl:HSL;
		private var hue:int = 0;
		private var quad0:Quad;
		private var quad1:Quad;
		public function Color2() 
		{
			
			hsl = new HSL();
			hsl.luminance = .5;
			hsl.saturation = .25;
			
			quad0 = new Quad( new Rectangle( 0, 0, 200, 200 ) );
			addChild( quad0 );
			quad0.x = sw / 2 + 100;
			quad0.y = sh / 2;
			
			quad1 = new Quad( new Rectangle( 0, 0, 200, 200 ) );
			addChild( quad1 );
			quad1.x = sw / 2 - 100;
			quad1.y = sh / 2;
			
			setInterval( update, 10 );
			
		}
		
		private function update():void 
		{
			
			hsl.hue = hue;
			quad0.fillColor = quad0.strokeColor = hsl.toHex();
			quad0.draw();
			
			hsl.hue = hue + 180;
			quad1.fillColor = quad1.strokeColor = hsl.toHex();
			quad1.draw();
			
			hue += 2;
			
		}
		
		
		
	}

}